home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / misc / TownMaze.lha / TownMaze / src.lzh / showdbmaze.c < prev    next >
C/C++ Source or Header  |  1991-08-04  |  2KB  |  79 lines

  1. /*
  2. ** showdbmaze.c  Copyright 1991 Kent Paul Dolan,
  3. **               Mountain View, CA, USA 94039-0755
  4. **
  5. ** Written to satisfy an inquiry on USENet's rec.games.programmer newsgroup.
  6. ** May be freely used or modified in any non-commercial work.  Copyrighted
  7. ** only to prevent patenting by someone else.
  8. */
  9.  
  10. #include <stdio.h>
  11. #include "townmaze.h"
  12. #include "townproto.h"
  13.  
  14. #ifdef __STDC__
  15. void showdebugmaze()
  16. #else
  17. int showdebugmaze()
  18. #endif
  19. {
  20.   int i, j, cellid;
  21.  
  22. /*
  23. ** Draw the character version of the maze to stdout.
  24. */
  25.  
  26.   fprintf(stdout,"\n");
  27.   for (i = 0; i < mazeheight; i++)
  28.   {
  29.     for (j = 0; j < mazewidth; j++)
  30.       if (((i%2)==1)&&((j%2)==1))
  31.       {
  32.         cellid = (i/2)*(mazewidth/2)+(j/2);
  33.         switch (statlist[cellid].status)
  34.         {
  35.           case ISOLATED:
  36.             fprintf(stdout,"%c",'I');
  37.             break;
  38.           case LIVE:
  39.             fprintf(stdout,"%c",'L');
  40.             break;
  41.           case DEAD:
  42.             fprintf(stdout,"%c",'D');
  43.             break;
  44.           case STREET:
  45.             switch (statlist[cellid].streetdir)
  46.             {
  47.             case -1:
  48.               fprintf(stdout,"%c",BLANK);
  49.               break;
  50.             case 0:
  51.               fprintf(stdout,"%c",'^');
  52.               break;
  53.             case 1:
  54.               fprintf(stdout,"%c",'>');
  55.               break;
  56.             case 2:
  57.               fprintf(stdout,"%c",'v');
  58.               break;
  59.             case 3:
  60.               fprintf(stdout,"%c",'<');
  61.               break;
  62.             default:
  63.               fprintf(stdout,"%c",'X');
  64.             }
  65.             break;
  66.           case UNUSED:
  67.             fprintf(stdout,"%c",'U');
  68.             break;
  69.           default:
  70.             fprintf(stdout,"%c",'?');
  71.         }
  72.       }
  73.       else
  74.         fprintf(stdout,"%c",cmaze[i][j]);
  75.     fprintf(stdout,"\n");
  76.   }
  77.   return;
  78. }
  79.